<template>
    <div>
        <div class="table-data">
            <el-table
                    v-loading="loading"
                    element-loading-text="正在加载"
                    element-loading-spinner="el-icon-loading" :data="tableData" :header-cell-style="headClass"
                    :height="tHeight" style="width:100%" class="table-box">
                <el-table-column label="id" width="50" prop="id"></el-table-column>
                <el-table-column label="规则名称" prop="title"></el-table-column>
                <el-table-column label="返现规则">
                    <template slot-scope="scope">
                        <p v-for="(item,index) in scope.row.config" :key="index">
                            充{{item.charge_amount}}送{{item.give_amount}}
                        </p>
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script lang="ts">
    import {Component, Vue, Provide, Prop, Watch} from "vue-property-decorator";
    import staff from "@/api/staffManag";

    @Component({
        components: {}
    })
    export default class companyRules extends Vue {
        // @Getter("user") getUser: any;
        @Provide() tableData: any = []; // 表格数据
        @Provide() tHeight: number = document.body.offsetHeight - 323;
        @Provide() total: number = 0; // 总数据条数
        @Provide() tabShow: Boolean = true; // 是显示否列表页面
        @Provide() loading: Boolean = true; // 是否显示加载图标
        @Prop({}) tabVisible!: any;
        @Provide() dialogVisible: Boolean = false;

        headClass() {
            return "text-align: center;background:#eef1f6;";
        }

        created() {
            this.loadData();
        }
        loadData() {
            staff.ruleList([])
                .then((res: any) => {
                    this.loading = false;
                    this.tableData = [res.data.data];
                });
        }
    }
</script>

<style lang="scss" scoped>
    .el-date-editor {
        margin-right: 10px;
    }
</style>
